<template>
  <div class="search">
    <el-form :inline="true" :model="formData" class="demo-form-inline">
      <el-form-item label="型号搜索：">
        <el-input v-model="formData.name" placeholder="请输入" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="queryName"
          ><i class="el-icon-search"></i>查询</el-button
        >
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { searchTypeTable } from '@/api/device/device_type'
export default {
  data () {
    return {
      formData: {
        name: ''
      }
    }
  },
  methods: {
    async queryName () {
      const { currentPageRecords } = await searchTypeTable({
        pageIndex: 1,
        pageSize: 10,
        name: this.formData.name
      })
      console.log(currentPageRecords)
      this.$emit('queryDevice', currentPageRecords)
    }
  }
}
</script>

<style lang="scss" scoped>
// 搜索
.search {
  display: flex;
  align-items: center;
  padding-left: 17px;
  .el-form {
    height: 36px;
    line-height: 36px;
    .el-button {
      width: 80px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 2px;
      .el-icon-search {
        margin-right: 5px;
      }
    }
  }
}
</style>
